package com.jason.orc.config;

import com.jason.orc.BaiduOrcClient;
import com.jason.orc.TencentOrcClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OrcClientConfig {
    @Value("${baidu.api.appId}")
    private String baiduAppId  ;
    @Value("${baidu.api.apiKey}")
    private String baiduApiKey;
    @Value("${baidu.api.secretKey}")
    private String baiduSecretKey;

    @Value("${tencent.youtu.api.appId}")
    private String tencentAppId  ;
    @Value("${tencent.youtu.api.secretId}")
    private String tencentSecretId;
    @Value("${tencent.youtu.api.secretKey}")
    private String tencentSecretKey;
    @Value("${tencent.youtu.api.userQQ}")
    private String userQQ;

    @Bean
    public BaiduOrcClient getBaiduOrcClient(){
        BaiduOrcClient aipOcr = new BaiduOrcClient(baiduAppId, baiduApiKey, baiduSecretKey);
        // 可选：设置网络连接参数
        aipOcr.setConnectionTimeoutInMillis(5000);
        aipOcr.setSocketTimeoutInMillis(60000);
        return aipOcr;
    }

    @Bean
    public TencentOrcClient getTencentOrcClient() {
        return new TencentOrcClient(userQQ, tencentAppId, tencentSecretId, tencentSecretKey);
    }
}
